using System;
using System.Windows;
using System.Windows.Data;
using XmlStudio.Enums;

namespace XmlStudio.Converters {
    // for collapse button
    public class ExpandedStateToVisibilityConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if(value is ExpandState) {
                var state = (ExpandState)value;
                switch(state) {
                    case ExpandState.Collapsed:
                        return Visibility.Collapsed;
                    case ExpandState.PartiallyExpanded:
                        return Visibility.Visible;
                    case ExpandState.Expanded:
                        return Visibility.Visible;
                    default:
                        return null;
                }
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            return null;
        }
    }
}
